home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CScrollList 1.0 / Demo Classes / CStringArray.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  1.2 KB  |  57 lines  |  [TEXT/KAHL]

  1. /*************************************************************************************
  2.  
  3.  CStringArray.c
  4.     
  5.         Just a simple array of Str255's.  Nothing fancy.
  6.     
  7.     SUPERCLASS = CArray
  8.     
  9.         © 1992 Dave Harkness
  10.  
  11. *************************************************************************************/
  12.  
  13.  
  14. #include "CStringArray.h"
  15.  
  16.  
  17. /*************************************************************************************
  18.  IStringArray
  19. *************************************************************************************/
  20.  
  21. void
  22. CStringArray::IStringArray( void)
  23.  
  24. {
  25.     CArray::IArray( sizeof(Str255));
  26.  
  27. }  /* CStringArray::IStringArray */
  28.  
  29.  
  30. /******************************************************************************
  31.  IRes
  32. ******************************************************************************/
  33.  
  34. void
  35. CStringArray::IRes( short strListID)
  36.  
  37. {
  38.     Handle        strList;
  39.     Str255        str;
  40.     short        i, numStrings;
  41.     
  42.     IArray( sizeof(Str255));
  43.     
  44.     strList = GetResource( 'STR#', strListID);
  45.     FailNILRes( strList);
  46.     
  47.     numStrings = *(short*) *strList;
  48.     Resize( numStrings);
  49.     
  50.     for (i = 1; i <= numStrings; i++)
  51.     {
  52.         GetIndString( str, strListID, i);
  53.         InsertAtIndex( str, i);
  54.     }
  55.  
  56. }  /* CStringArray::IRes */
  57.